﻿namespace BM.Tools.WebControls.MForm.Controls.Additions.IdentityConstraints
{
    using System.Diagnostics.CodeAnalysis;

    using BM.Tools.WebControls.MForm.Controls.Helper;

    /// <summary>
    /// The control that informs the item that it is a key
    /// </summary>
    internal class Key : BaseIdentity
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Key"/> class. 
        /// </summary>
        /// <param name="name">
        /// The name of the key.
        /// </param>
        /// <param name="rootPath">
        /// The root path.
        /// </param>
        /// <param name="autoFill">
        /// The auto fill.
        /// </param>
        /// <param name="autoFillMethodName">
        /// The auto Fill Method Name.
        /// </param>
        public Key(string name, string rootPath, bool autoFill, string autoFillMethodName) : base(name, rootPath)
        {
            AutoFill = autoFill;
            AutoFillMethodName = autoFillMethodName;
        }

        /// <summary>
        /// Gets or sets a value indicating whether the key should be automatically filled.
        /// </summary>
        /// <value>
        /// The auto fill.
        /// </value>
        [AttributeProperty(Name = "autoFill")]
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "It is used by the attribute property")]
        public bool AutoFill
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets a value that invokes the autoFill method.
        /// </summary>        
        [AttributeProperty(Name = "autoFillMethodName")]
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "It is used by the attribute property")]
        public string AutoFillMethodName
        {
            get;
            set;
        }
    }
}